package com.xiaoxin.yixinai.role;

import java.util.List;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.xiaoxin.yixinai._frame.base.BaseRepository;

@Repository
public interface RoleUserDao extends BaseRepository<RoleUser> {

    @Modifying
    @Query("delete from RoleUser where userId=:userId and type=:type")
    void deleteRolesByUserId(@Param("userId") Integer userId,@Param("type") Integer type);

    @Modifying
    @Query("delete from RoleUser where userId in (:userIds)")
    void deleteRoleUsersByUserId(@Param("userIds") List<Integer> userIds);
    
    RoleUser findByUserId(Integer userId);
 }
